package com.skyolder.milkbee.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A Questionnaire.
 */
@Entity
@Table(name = "questionnaire")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Questionnaire implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "title")
    private String title;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "leaguer_id")
    private Long leaguerId;

    @Column(name = "created_at")
    private ZonedDateTime createdAt;

    @Column(name = "end_at")
    private ZonedDateTime endAt;

    @Column(name = "detail")
    private String detail;

    @Column(name = "single")
    private Integer single;

    @Column(name = "category_id")
    private Long categoryId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public Questionnaire title(String title) {
        this.title = title;
        return this;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Long getUserId() {
        return userId;
    }

    public Questionnaire userId(Long userId) {
        this.userId = userId;
        return this;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getLeaguerId() {
        return leaguerId;
    }

    public Questionnaire leaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
        return this;
    }

    public void setLeaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
    }

    public ZonedDateTime getCreatedAt() {
        return createdAt;
    }

    public Questionnaire createdAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    public void setCreatedAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public ZonedDateTime getEndAt() {
        return endAt;
    }

    public Questionnaire endAt(ZonedDateTime endAt) {
        this.endAt = endAt;
        return this;
    }

    public void setEndAt(ZonedDateTime endAt) {
        this.endAt = endAt;
    }

    public String getDetail() {
        return detail;
    }

    public Questionnaire detail(String detail) {
        this.detail = detail;
        return this;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public Integer getSingle() {
        return single;
    }

    public Questionnaire single(Integer single) {
        this.single = single;
        return this;
    }

    public void setSingle(Integer single) {
        this.single = single;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public Questionnaire categoryId(Long categoryId) {
        this.categoryId = categoryId;
        return this;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Questionnaire questionnaire = (Questionnaire) o;
        if (questionnaire.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, questionnaire.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Questionnaire{" +
            "id=" + id +
            ", title='" + title + "'" +
            ", userId='" + userId + "'" +
            ", leaguerId='" + leaguerId + "'" +
            ", createdAt='" + createdAt + "'" +
            ", endAt='" + endAt + "'" +
            ", detail='" + detail + "'" +
            ", single='" + single + "'" +
            ", categoryId='" + categoryId + "'" +
            '}';
    }
}
